home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 December / 2004-12 CHIP.iso / Narzedzia systemowe / Inno Setup 5.0.4 Beta / isetup-5.0.4-beta.exe / {app} / Examples / CodeDll.iss (.txt) < prev    next >
Encoding:
Inno Setup Script  |  2004-02-06  |  1.7 KB  |  41 lines

  1. ; -- CodeDll.iss --
  2. ; This script shows how to call DLL functions at runtime from a [Code] section.
  3. [Setup]
  4. AppName=My Program
  5. AppVerName=My Program version 1.5
  6. DefaultDirName={pf}\My Program
  7. DisableProgramGroupPage=yes
  8. UninstallDisplayIcon={app}\MyProg.exe
  9. [Files]
  10. Source: "MyProg.exe"; DestDir: "{app}"
  11. Source: "MyProg.hlp"; DestDir: "{app}"
  12. Source: "Readme.txt"; DestDir: "{app}"; Flags: isreadme
  13. Source: "MyDll.dll"; Flags: dontcopy
  14. ;Source: "MyDll.dll"; DestName: "MyDllWhichMightNotExist.dll"; Flags: dontcopy
  15. [Code]
  16. const
  17.   MB_ICONINFORMATION = $40;
  18. //importing a Windows API function
  19. function MessageBox(hWnd: Integer; lpText, lpCaption: String; uType: Cardinal): Integer;
  20. external 'MessageBoxA@user32.dll stdcall';
  21. //importing a custom DLL function
  22. procedure MyDllFunc(hWnd: Integer; lpText, lpCaption: String; uType: Cardinal);
  23. external 'MyDllFunc@files:MyDll.dll stdcall';
  24. //importing a function for a DLL which might not exist at runtime, see [Files] ('delay loading')
  25. procedure MyDelayLoadedFunc(hWnd: Integer; lpText, lpCaption: String; uType: Cardinal);
  26. external 'MyDllFunc@files:MyDllWhichMightNotExist.dll stdcall delayload';
  27. function NextButtonClick(CurPage: Integer): Boolean;
  28.   hWnd: Integer;
  29. begin
  30.   if CurPage = wpWelcome then begin
  31.     hWnd := StrToInt(ExpandConstant('{wizardhwnd}'));
  32.     MessageBox(hWnd, 'Hello from Windows API function', 'MessageBoxA', MB_OK or MB_ICONINFORMATION);
  33.     MyDllFunc(hWnd, 'Hello from custom DLL function', 'MyDllFunc', MB_OK or MB_ICONINFORMATION);
  34.     try
  35.       MyDelayLoadedFunc(hWnd, 'Hello from delay loaded function', 'MyDllFunc', MB_OK or MB_ICONINFORMATION);
  36.     except
  37.       //handle missing dll here
  38.     end;
  39.   end;
  40.   Result := True;
  41.